package com.amex.uam.action;

import com.microstrategy.web.beans.RequestKeys;

public class GetParameters {

	public void getParameters(RequestKeys keys) {
		//-------------------------------
		// User Type
		//-------------------------------
		String userTypeVal = keys.getValue("usrTpRadio");// modified : object
		String userTypeOri = keys.getValue("ori_usrTpRadio"); // original : object
		
		//System.out.println("User Type modified: " + userTypeVal);
		//System.out.println("User Type original: " + userTypeOri);
		
		//-------------------------------
		// GMAPS
		//-------------------------------
		String gmapsVal = keys.getValue("gmapsRadio"); // modified : object : -1 indicates no access
		String gmapsOri = keys.getValue("ori_gmapsRadio");// original : object
		
		// System.out.println("GMAPS modified: " + gmapsVal);
		// System.out.println("GMAPS original: " + gmapsOri);
		
		//-------------------------------
		//MARC Functional Group
		//-------------------------------
		String marcFuncVal = keys.getValue("marcFuncRadio"); // modified : list
		String marcFuncOri = keys.getValue("ori_marcFuncRadio"); // original : list 
		/*
		System.out.println("MARC Functional Group - modified: " + marcFuncVal);
		if (marcFuncVal != null) {
			String[] groups = marcFuncVal.split(",");
			for (String groupName : groups) {
				if (groupName.trim().length() > 0) {
					System.out.println("--" + groupName);
				}
			}
		}
		System.out.println("MARC Functional Group - original: " + marcFuncOri);
		if (marcFuncOri != null) {
			String[] groups = marcFuncOri.split(",");
			for (String groupName : groups) {
				if (groupName.trim().length() > 0) {
					System.out.println("--" + groupName);
				}
			}
		}
		*/
		
		//-------------------------------
		//Opt Blue
		//-------------------------------
		String optBlueVal = keys.getValue("optBlueRadio"); // modified : object : -1 indicates no access
		String optBlueOri = keys.getValue("ori_optBlueRadio");// original : object
		
		/*System.out.println("Opt Blue - modified: " + optBlueVal);
		System.out.println("Opt Blue - original: " + optBlueOri);*/

		//-------------------------------
		// Shared Reports
		//-------------------------------
		String sharedRpt = keys.getValue("sharedRptRadio");// yes:有访问权限, no:没有访问权限
		
		String sharedRptOri = keys.getValue("ori_shdRptVal");// original : list
		String sharedRptNames = keys.getValue("shdRptName");// parameter names
		/*
		System.out.println("Shared Reports: " + sharedRpt);
		System.out.println("Shared Reports - parameter.names: " + sharedRptNames);
		if (sharedRptNames != null) {
			String[] paramNames = sharedRptNames.split(",");
			for (String pname : paramNames) {
				if (pname.trim().length() > 0) {
					System.out.println("--" + pname + " : " + keys.getValue(pname));
				}
			}
		}
		System.out.println("Shared Reports - original: " + sharedRptOri);
		if (sharedRptOri != null) {
			String[] groups = sharedRptOri.split(",");
			for (String groupName : groups) {
				if (groupName.trim().length() > 0) {
					System.out.println("--" + groupName);
				}
			}
		}
		*/
		//-------------------------------
		// LIF Exception
		//-------------------------------
		String lifExcep = keys.getValue("lifExcepRadio");// global:全球, rgCt:选中地区和国家
		
		String lifExcepCountry = keys.getValue("rcCtry");// 国家名称列表
		String lifExcepRegion = keys.getValue("rcRgn");// 地区名称列表
		
		System.out.println("LIF Exception: " + lifExcep);
		System.out.println("LIF Exception - modified: " + lifExcepCountry);
		if (lifExcepCountry != null) {
			String[] items = lifExcepCountry.split(",");
			for (String item : items) {
				if (item.trim().length() > 0) {
					System.out.println("--" + item);
				}
			}
		}
		System.out.println("LIF Exception - original: " + lifExcepRegion);
		if (lifExcepRegion != null) {
			String[] items = lifExcepRegion.split(",");
			for (String item : items) {
				if (item.trim().length() > 0) {
					System.out.println("--" + item);
				}
			}
		}
	}
	
}
